algorithms for gate cse